<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');


$subject_id = $_GET['sid'];

//counting variable
$i = 0;

$get_sname = "SELECT * FROM course_subjects WHERE id='$subject_id'";
$result_sname = mysql_query($get_sname);
$subject_name = mysql_result($result_sname,0,"subject_title");

echo "<p>";
	echo "<a href='index.php?id=$subject_id'>&lt;&lt; Back to Subject/Building Mapping Portal</a><br />";
echo "</p>";
echo "<h1>Add Subject/Building Mapping for $subject_name</h1>";

$query="SELECT * FROM buildings";
$result=mysql_query($query);

//determine dynamically number of rows read from table
$num_rows=mysql_numrows($result);


echo '<p>';

$classroom_type_id = 1;

echo "<form action='add_do.php' method='post'>";

//start table
echo "<table border='0'>";
	
	//create table row
	echo "<tr>";
		echo "<td><b>Building: </b></td>";
		echo "<td>";
			echo "<select name='building'>";
				while ($i < $num_rows)
				{
					$building_name=mysql_result($result,$i,"building_name");
					$building_id=mysql_result($result,$i,"id");
					echo "<option value=$building_id>$building_name</option>";
					$i++;
				}
			echo "</select>";
	echo "</tr>";


//end table tag
echo "</table>";




echo "<input type='hidden' name='sid' value='$subject_id'>";
echo "<p><input type='submit'></p>";
echo '</form>';



?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>